﻿using Pay.Api.App_Start;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;

namespace Pay.Api
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            //配置跨域
            config.EnableCors(new System.Web.Http.Cors.EnableCorsAttribute("*", "*", "*"));

            // Web API 路由
            config.MapHttpAttributeRoutes();


            //config.Filters.Add(new ApiAuthorizeAttribute());

            config.Filters.Add(new ApiResultAttribute());

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );
            LotWebApiConfig.ConfigureApi(config);
        }
    }
}
